package com.commons.service.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.*;
import lombok.*;
import org.springframework.format.annotation.*;

import java.time.*;
import java.util.*;


/**
 * 基础实体类
 * @author longyh
 * @since 2022/8/15
 */
@Getter
@Setter
public class BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 删除标识：0未删除，1已删除
     */
    @TableField(value = "delete_flag",fill = FieldFill.INSERT)
    private Integer deleteFlag;
    /**
     * 创建人
     */
    @TableField(value = "create_by",fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 创建主键
     */
    @TableField(value = "create_id",fill = FieldFill.INSERT)
    private Long createId;
    /**
     * 创建时间
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    /**
     * 修改人
     */
    @TableField(value = "update_by",fill = FieldFill.UPDATE)
    private String updateBy;
    /**
     * 修改人主键
     */
    @TableField(value = "update_id",fill = FieldFill.UPDATE)
    private String updateId;
    /**
     * 修改时间
     */
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    /** 连表请求参数 */
    @JsonIgnore
    @TableField(exist = false)
    private Map<String, Object> joinParams = new HashMap<>();

    /** 查询请求参数 */
    @JsonIgnore
    @TableField(exist = false)
    private Map<String, Object> searchParams = new HashMap<>();
}
